package com.chinacoal.microservice.controller;

import com.chinacoal.microservice.FeeRateTemplateClient;
import com.chinacoal.microservice.pojo.CcmsSmartleasingRoom;
import com.chinacoal.microservice.pojo.CcmsSmartleasingTaxRateTemplate;
import com.chinacoal.microservice.service.FeeRateTemplateService;
import com.chinacoal.microservice.util.PassToken;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import com.chinacoal.microservice.util.UserLoginToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 费用税率模板-后端控制类
 * @date 2020-12-05 15：01
 */
@RestController
public class FeeRateTemplateController implements FeeRateTemplateClient {

    @Autowired
    private FeeRateTemplateService feeRateTemplateService;

    /**
     * @Description: 查询所有的费用税率模板信息(带分页)
     * @author zhuliang
     * @date 2020/12/5 15:20
     */
    @Override
    @PassToken
    public Result<List<CcmsSmartleasingTaxRateTemplate>> getAllByPage(QueryCriteria queryCriteria) {
        return feeRateTemplateService.getAllByPage(queryCriteria);
    }

    /**
     * @Description: 条件查询所有的费用税率模板信息(带分页)
     * @author zhuliang
     * @date 2020/12/5 15:29
     */
    @Override
    @PassToken
    public Result<List<CcmsSmartleasingTaxRateTemplate>> getAllByCondition(QueryCriteria queryCriteria) {
        return feeRateTemplateService.getAllByCondition(queryCriteria);
    }

    /**
     * @Description: 查询相关房间信息
     * @author zhuliang
     * @date 2020/12/5 16:02
     */
    @Override
    @PassToken
    public Result<List<CcmsSmartleasingRoom>> echoAssociatedRoom(String pkTaxRateTemplateId) {
        return feeRateTemplateService.echoAssociatedRoom(pkTaxRateTemplateId);
    }

    /**
     * @Description: 添加费用税率模板消息
     * @author zhuliang
     * @date 2020/12/5 16:18
     */
    @Override
    @UserLoginToken
    public Result addFeeRateTemplate(CcmsSmartleasingTaxRateTemplate taxRateTemplate, String token) {
        return feeRateTemplateService.addFeeRateTemplate(taxRateTemplate, token);
    }

    /**
     * @Description: 根据税率模板id查询模板消息
     * @author zhuliang
     * @date 2020/12/5 16:23
     */
    @Override
    @PassToken
    public Result<CcmsSmartleasingTaxRateTemplate> getTemplateById(String pkTaxRateTemplateId) {
        return feeRateTemplateService.getTemplateById(pkTaxRateTemplateId);
    }

    /**
     * @Description: 修改费用税率模板消息
     * @author zhuliang
     * @date 2020/12/5 16:33
     */
    @Override
    @UserLoginToken
    public Result updateTemplate(CcmsSmartleasingTaxRateTemplate taxRateTemplate, String token) {
        return feeRateTemplateService.updateTemplate(taxRateTemplate, token);
    }

    /**
     * @Description: 根据税率模板id删除模板消息
     * @author zhuliang
     * @date 2020/12/5 16:50
     */
    @Override
    @UserLoginToken
    public Result deleteTemplate(String pkTaxRateTemplateId, String token) {
        return feeRateTemplateService.deleteTemplate(pkTaxRateTemplateId, token);
    }
}
